package com.ruoyi.project.learn.video.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.learn.video.mapper.DjStudyVideoMapper;
import com.ruoyi.project.learn.video.domain.DjStudyVideo;
import com.ruoyi.project.learn.video.service.IDjStudyVideoService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 学习视频Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-17
 */
@Service
public class DjStudyVideoServiceImpl implements IDjStudyVideoService 
{
    @Autowired
    private DjStudyVideoMapper djStudyVideoMapper;

    /**
     * 查询学习视频
     * 
     * @param id 学习视频主键
     * @return 学习视频
     */
    @Override
    public DjStudyVideo selectDjStudyVideoById(Long id)
    {
        return djStudyVideoMapper.selectDjStudyVideoById(id);
    }

    /**
     * 查询学习视频列表
     * 
     * @param djStudyVideo 学习视频
     * @return 学习视频
     */
    @Override
    public List<DjStudyVideo> selectDjStudyVideoList(DjStudyVideo djStudyVideo)
    {
        return djStudyVideoMapper.selectDjStudyVideoList(djStudyVideo);
    }

    /**
     * 新增学习视频
     * 
     * @param djStudyVideo 学习视频
     * @return 结果
     */
    @Override
    public int insertDjStudyVideo(DjStudyVideo djStudyVideo)
    {
        djStudyVideo.setCreateTime(DateUtils.getNowDate());
        return djStudyVideoMapper.insertDjStudyVideo(djStudyVideo);
    }

    /**
     * 修改学习视频
     * 
     * @param djStudyVideo 学习视频
     * @return 结果
     */
    @Override
    public int updateDjStudyVideo(DjStudyVideo djStudyVideo)
    {
        djStudyVideo.setUpdateTime(DateUtils.getNowDate());
        return djStudyVideoMapper.updateDjStudyVideo(djStudyVideo);
    }

    /**
     * 批量删除学习视频
     * 
     * @param ids 需要删除的学习视频主键
     * @return 结果
     */
    @Override
    public int deleteDjStudyVideoByIds(String ids)
    {
        return djStudyVideoMapper.deleteDjStudyVideoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除学习视频信息
     * 
     * @param id 学习视频主键
     * @return 结果
     */
    @Override
    public int deleteDjStudyVideoById(Long id)
    {
        return djStudyVideoMapper.deleteDjStudyVideoById(id);
    }
}
